class Person{
  // 属性
  name: string;
  age: number;
  gender: string;

  // 方法
  constructor(name: string, age: number, gender: string){
    this.name = name;
    this.age = age;
    this.gender = gender;
  }

  weixiu(computer: string){
    console.log('我可以维修' + computer);
  }
}
// let xudong = new Person('徐东', 18, '男');
// xudong.weixiu('洗衣机');

//声明一个子类
class Programmer extends Person{
  language: string;
  keyboard: string;

  //构造方法
  constructor(name: string, age: number, gender: string, language: string, keyboard: string){
    super(name, age, gender); // 
    this.language = language;
    this.keyboard = keyboard;
  }

  program(){
    console.log(`我可以编写 ${this.language} 代码...`);
  }

  weixiu() {
    console.log('我可以修笔记本');
  }
}

//实例化
let tianqing = new Programmer('田晴', 18, '女', 'JavaScript', '双飞燕');

// tianqing.program();
// tianqing.weixiu();


/****************************** */
class Girl{
  public name: string;
  protected age: number;
  private weight: number;

  constructor(name: string, age: number, weight: number){
    this.name = name;
    this.age = age;
    this.weight = weight;
  }

  intro(){
    console.log(`我叫 ${this.name}, 今年 ${this.age}, 体重是 ${this.weight}`);
  }
}

class Test extends Girl{
  getInfo(){
    console.log(this.name);
    console.log(this.age);
    // console.log(this.weight); //X
    // console.log(123);
  }
}

let yaru = new Girl('亚茹', 24, 100);
// console.log(yaru.name); //√
// console.log(yaru.age); // X
// console.log(yaru.weight) // X 
// yaru.intro();


let gulinazha = new Test('古力娜扎', 30, 96);
gulinazha.getInfo();



